package com.yuandian.management.service.impl;

import com.yuandian.management.mapper.AgentTableMapper;
import com.yuandian.management.service.IAgentTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * agent找表
 * 
 * @author fucx
 * @date 2020/06/16
 */

@Service
public class AgentTableServiceImpl implements IAgentTableService {
    private static final String AGENT_STATUS_TABLE = "conf_agent_status_info";

    @Autowired
    private AgentTableMapper agentTableMapper;

    /**
     * 获取按开始和结束时间对应的表
     * 
     * @param startTime
     * @param endTime
     * @return
     */
    @Override
    public List<String> getHistoryAgentTable(Date startTime, Date endTime) {
        List<String> list = new ArrayList<String>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        String startStr = sdf.format(startTime);
        String endStr = sdf.format(endTime);
        int start = Integer.parseInt(startStr);
        int end = Integer.parseInt(endStr);

        list.add(AGENT_STATUS_TABLE);




        return list;
    }

    /**
     * 只获取当天的表
     *
     * @param startTime
     * @return
     */
    @Override
    public String getTodayAgentTable(Date startTime) {
        String tableName = AGENT_STATUS_TABLE;
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
//        String dateStr = sdf.format(startTime);
//        tableName = tableName + "_" + dateStr;
        return tableName;
    }

}
